﻿using System;
using System.Collections.Generic;
using System.Linq;
using SD.LLBLGen.Pro.ORMSupportClasses;
using SD.LLBLGen.Pro.LinqSupportClasses;
using Northwinddemo.BusinessLayer.Repository.Abstract;
using Northwinddemo.DAL.EntityClasses;
using Northwinddemo.DAL.DatabaseSpecific;
using Northwinddemo.DAL.Linq;
using MvcContrib.Pagination;
using System.Collections.Specialized;
using BaseBL;
using xVal.ServerSide;

namespace Northwinddemo.BusinessLayer.Repository.Concrete
{
    public class SuppliersRepository : NortwindRepository<SuppliersEntity>, ISuppliersRepository
    {

        public override SuppliersEntity GetById(int supplierId, IDataAccessAdapter adapter)
        {
            return (from s in new LinqMetaData(adapter).Suppliers
                    where s.SupplierId == supplierId
                    select s).Single();
        }

        public override IList<SuppliersEntity> GetAll(IDataAccessAdapter adapter)
        {
            return (from s in new LinqMetaData(adapter).Suppliers
                    orderby s.CompanyName, s.City
                    select s).ToList();
        }

    }
}
